// utils/api.js
module.exports = {
  request: (url, method, data, header = {}) => {
    return new Promise((resolve, reject) => {
      wx.request({
        url,
        method,
        data,
        header: {
          'content-type': 'application/x-www-form-urlencoded',
          ...header
        },
        success: res => resolve(res.data),
        fail: err => reject(err)
      });
    });
  }
};